<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><{$site_title}>管理中心</title>
<{include file="js.html"}>
</head>

<body>
<div class="box" >
<div style="background:url(images/mainbj.jpg) repeat-x; line-height:31px; height:31px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td width="41" align="center">
<img src="images/biao1.jpg" /></td>
<td><strong>当前位置</strong>：公司管理 &gt; 公司列表 &gt; <{$row.title}>审核</td>
</tr></table>
</div>


<form action="" method="post" id="myForm" enctype='multipart/form-data'>
<table width="849" cellpadding="0" cellspacing="0" class="lefttab">
<tr><td colspan="7"><div style="height:26px; text-align:left; line-height:26px; background:url(images/xbj1.jpg) repeat-x; border:1px solid #e9f5fa;font-weight:bold;">&nbsp;&nbsp;公司申请</div>
</td></tr>
<tr id="top" style="background:#dceff6;">
  <td><strong>选择</strong></td>
  <td><strong>待审核项</strong></td>
  <td value_id="<{$row.id}>"><strong>审核内容</strong></td>
   <td value_id="<{$row.id}>"><strong>审核状态</strong></td>
  <td value_id="<{$row.id}>"><strong>是否通过</strong></td>
</tr>
<{foreach item=row from=$row}>

<tr line_id="<{$row.id}>">
<td> <input type="checkbox" name="checkbox" value="<{$row.id}>" /></td>
   <td value_id="<{$row.id}>"><{$row.title}></td>
  <td value_id="<{$row.id}>"><{$row.content}></td>
   <td value_id="<{$row.id}>" class="td-status" ><span  class="label label-primary  radius">待审核</span></td>
   <td class="f-14 td-manage"><a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="待审核">待审核</a></td>
  <script type="text/javascript">
   var obj = '#'+'<{$row.id}>';
   var id = '<{$row.id}>';
  if('<{$row.state}>'==0)
  {
	 
		$(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">未通过</span>');
		 $(obj).replaceWith('<a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="未通过">未通过</a>');
  }
  if('<{$row.state}>'==1)
  {
  }
   if('<{$row.state}>'==2)
  {
	  		
		
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已通过</span>');
		$(obj).replaceWith('<a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="已通过">已通过</a>');
  }
  </script>

  <{/foreach}>
</table>
<div class="fenye" >
    <p>&nbsp;</p>
      <p style="">&nbsp;&nbsp;<a onclick='allcheck()' href="javascript:void(0)">全选</a> | <a onclick="allcheck_success('<{$_basename}>?action=check','是否否全部通过')" href="javascript:void(0)">通过</a> &nbsp;&nbsp;&nbsp;&nbsp;<{$page}>&nbsp;<a   style = "text-decoration:none;color:black; background-color:#336 font-size:60px;  margin-right:170px; float:right;margin-top:-10px" > <button  class="inp" style="width:80px; height:30px;  onclick="javascript:history.back(-1);">返回</button></a> <a  class="inp" style=" margin-top:-10px;float:right; margin-right:5px;text-decoration:none " href="<{$_basename}>?action=check_finshed&id=<{$company_id}>&false=0&success=2" ><label style="margin-left:20px;color:#333">已审核</label></a><a class="inp" style="float:right;margin-right:5px; width:80px;margin-top:-10px;text-decoration:none " href="<{$_basename}>?action=check_no&id=<{$company_id}>&state=1"><label style="margin-left:20px; color:#333 ">待审核</label></a></p>
  </div>

</form>>
</div>
<script type="text/javascript">
function allcheck_success(url,msg){
	if(msg==''){
		msg = "是否删除所选项？";
	}
	var c = confirm(msg);
	if(c){
		var id="";
		$len = $("input[name='checkbox']:checked").length;
		$i = 0;
		var arrayObj = new Array();
		
		$("input[name='checkbox']:checked").each(function(){
			//"input[name='checkbox']:checked"与老版本不一样
			id=$(this).val();
			var  objOne = $("#"+id);
			var lenth = arrayObj.length;
			arrayObj[lenth]= objOne;
			$.post(
			url,
			{id:id,state:2},
			function(data){
				if(data=='1'){
						
					$i++;
					if($i==$len)
					{
						for( var key in arrayObj)
						{
							var obj = arrayObj[key];
							
		                    $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已通过</span>');
							$(obj).replaceWith('<a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="已通过">已通过</a>');
						}
						layer.msg('已通过', {icon:6,time:1000});
						
						
						//window.location.reload();
					}
				}
			}
		)
			
		})
		
	}else{
		return false;
	}
}

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,8]}// 制定列不参与排序
	]
});

/*资讯-添加*/
function article_add(title,url,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: false,
		content: url
		
	});
	layer.full(index);
}
/*资讯-删除*/
function article_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon: 1});
	});
}
/*资讯-审核*/
function article_shenhe(obj){
	
	layer.confirm('通过审核？', {
		btn: ['通过','不通过'], 
		shade: false
	},
	function(){
		var url = '<{$_basename}>?action=check';
		var id = $(obj).prop("id");
		$.post(
			url,
			{id:id,state:2},
			function(data){
				if(data=='1'){
					
				
		        $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已通过</span>');
				$(obj).replaceWith('<a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="已通过">已通过</a>');	
				layer.msg('已通过', {icon:6,time:1000});
		
		
				}
			}
		)
		
	},
	function(){
		var url = '<{$_basename}>?action=check';
		var id = $(obj).prop("id");
		$.post(
			url,
			{id:id,state:0},
			function(data){
				if(data=='1'){
					
		
		$(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">未通过</span>');
		$(obj).replaceWith('<a class="c-primary" id="<{$row.id}>" onClick="article_shenhe(this)" href="javascript:;" title="未通过">未通过</a>');
    	layer.msg('未通过', {icon:5,time:1000});
				}
			}
		)
	
	});	
}
/*资讯-下架*/
function test()
{

	layer.confirm('您是如何看待前端开发？', {
  btn: ['重要','奇葩'] //按钮
}, function(){
  layer.msg('的确很重要', {icon: 1});
}, function(){
  layer.msg('也可以这样', {
    time: 20000, //20s后自动关闭
    btn: ['明白了', '知道了']
  });
});

}

function article_stop(obj,id){
	
	layer.confirm('确认要下架吗？',function(index){
	
		//将一个jsObject转换成JQueryObjec
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="article_start(this,id)" href="javascript:;" title="发布"><i class="Hui-iconfont">已发布</i></a>');
		
		$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已下架</span>');
		$(obj).remove();
		layer.msg('已下架!',{icon: 5,time:1000});
		
	});
}

/*资讯-发布*/
function article_start(obj,id){
	layer.confirm('确认要发布吗？',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="article_stop(this,id)" href="javascript:;" title="下架"><i class="Hui-iconfont">下架</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发布</span>');
		$(obj).remove();
		layer.msg('已发布!',{icon: 6,time:1000});
	});
}
/*资讯-申请上线*/
function article_shenqing(obj,id){
	$(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">待审核</span>');
	$(obj).parents("tr").find(".td-manage").html("");
	layer.msg('已提交申请，耐心等待审核!', {icon: 1,time:2000});
	
}

</script> 
</body>
</html>